package com.db_tenant;


import io.ebean.EbeanServer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Profile;

import java.util.Arrays;
import java.util.List;

@Slf4j
@Configuration
@Profile("pre")
public class CitusRwTenantConfig_Pre extends CitusRwTenantConfig {

  String coordinate = "127.0.0.1";
  List<String> workers = Arrays.asList("127.0.0.1", "127.0.0.1");
  String port = "5432";
  String database = "dev_imessage";
  String username = "postgres";
  String password = "123456";

  //----------------
  @Bean
  @Lazy
  @Override
  public EbeanServer ebeanServer(ThreadLocalTenant tlTenant, CitusDataSrcProvider provider) {
    log.info("load pre configuration.");
    return super.ebeanServer(tlTenant, provider);
  }

  //----------------
  @Override
  public String coordinate() {
    return coordinate;
  }

  @Override
  public List<String> workers() {
    return workers;
  }

  @Override
  public String port() {
    return port;
  }

  @Override
  public String database() {
    return database;
  }

  @Override
  public String username() {
    return username;
  }

  @Override
  public String password() {
    return password;
  }
}
